<?php
// 修饰器模式
// 动态地添加方法
// 
interface Component {}
class MyComponent implements Component {}

interface Decorator
{
	protected $component;

	public function __construct(Component $component)
	{
		$this->component = $component;
	}

	abstract public function addMethod();
}

class MyDecorator implements Decorator
{
	public function addMethod()
	{

	}
}

$myComponent = new MyComponent;
$myDecorator = new MyDecorator($myComponent);
$myDecorator->addMethod();